package com.fhz.a1909.viewmodel;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

/**
 * 时间:2022/3/19
 *
 * @author msfeng
 * 简述: 缓存页面中的所有数据.
 */
public class MyViewModel extends ViewModel {

    private MutableLiveData<Integer> integerMutableLiveData;

    public MutableLiveData<Integer> getInt(){
        if(integerMutableLiveData == null){
            integerMutableLiveData = new MutableLiveData<>();
            addInt();
        }
        return integerMutableLiveData;
    }

    private void addInt() {
        integerMutableLiveData.postValue(1);

    }


}

